def predict_by_weighted_sum_regression(x, weights, bias):
    """
        感知机预测函数
        input: 3个特征值
        output: 1个预测值
    """
    # 计算加权和
    weighted_sum = sum([x[j] * weights[j] for j in range(len(weights))]) + bias
    return weighted_sum
def predict_by_weighted_sum_classification(x, weights, bias):
    """
        感知机预测函数
        input: 3个特征值
        output: 1个预测值
    """
    # 计算加权和
    weighted_sum = sum([x[j] * weights[j] for j in range(len(weights))]) + bias

    return 1 if weighted_sum >= 0 else 0